# 定义字典
dict={
    "name":"张三","age":20,"gender":"男"
}

# 读取字典属性
# print(dict["name"])
# print(dict.get('name2'))

# squares = {f"key{x}": x**2 for x in range(1, 6)}
# print(squares)

# for key,value in dict.items():
#     print(key,value)
# 遍历字典的key
# for key in dict:
#     print(key)
# 遍历字典的值
# for value in dict.values():
#     print(value)

# print(dict.keys(),type(dict.keys()))
# print(dict.values())

# print(dict.copy(),dict.copy()==dict)

# 字典update方法
# dict.update({"name":"浪子"})
dict.update([("name","王杰"),("birthday",1962)])
print(dict)